package week3;

import java.util.Scanner;

public class q2 {
    public static void main(String[] args) {
        int random=(int)(Math.random()*100);
        int guess;
        int count=0;
        Scanner sc=new Scanner(System.in);
        while(true){
            System.out.println("请输入一个0~100的数：");
            guess= sc.nextInt();
            if(guess==random){
                System.out.println("正确");
                count++;
                System.out.println("猜测次数："+count);
                break;
            } else if (guess<random) {
                System.out.println("偏小");
                count++;
            }else if (guess>random){
                System.out.println("偏大");
                count++;
            }
        }
    }
}
